import pandas as pd
pd.set_option('display.unicode.east_asian_width',True)
df=pd.read_excel('超市运营数据.xlsx')
data = []
for i in range(df['折扣'].size):
    if df['折扣'][i]==0:
        data.append(i)
    else:
        data.append(df['折扣'][i])
df['总额']=df['价格']*df['数量']*data
df1 =df.groupby('销售经理').agg({'总额': 'sum'})
df1['排名'] = df1.rank(method='first',ascending=False)
df1.sort_values(by='排名',ascending=True,inplace=True)
print('按渠道的总额降序排名,以及按排名升序排序：\n',df1)

df2 = pd.crosstab(index=df['客户类型'],columns=df['销售经理'])
print('渠道和是否点击的交叉表：\n', df2)

